﻿








-- 取得卡信息
create procedure [dbo].[CaInfo_Get]
@kh varchar(10) = null,
@kbs varchar(20) = null,
@sfyx bit = null,
@RowCount int = 200
as
set rowcount @RowCount

select kh,kbs,sfyx,
case sfyx when 0 then '无效' else '有效' end sfyx_desc
from Ca_Info
where (@kh is null or kh=@kh) and
	(@kbs is null or kbs like @kbs+'%') 
order by kbs desc

select cntyx+cntwx total,cntyx,cntwx from
(
(select count(1) cntyx from Ca_Info where sfyx=1 and (@kh is null or kh=@kh) and
	(@kbs is null or kbs like @kbs+'%')) aa inner join
(select count(1) cntwx from Ca_Info where sfyx=0 and (@kh is null or kh=@kh) and
	(@kbs is null or kbs like @kbs+'%') ) cc on(1=1)
)

set rowcount 0